#ifndef ZIGBEEDEVICE_H
#define ZIGBEEDEVICE_H

#include <string>
#include <netinet/in.h>
#include <termios.h>
#include <iostream>

#include "common.h"
#include "thread.h"

using namespace std;

class zigbeeDevice : public Thread
{
	int *ppMap;
	int serial_fd;
	Thread *readThread;
	struct sockaddr_in commitAddr;
	int commit_sockfd;
	int open_serial_port(const string&);

public:
	//zigbeeDevice(int *ppMap);
	zigbeeDevice();
	~zigbeeDevice();
	void setSerial(const int);
	void set_speed(int speed);
	int set_data_format(int sotpbits, int soptbits, int parity);
	void sendMessage(int nodeID, char *buff, int buffSize);
	unsigned short int GetCrc16(char* InStr, unsigned int len);
	void run();
	void startDevice();
};

#endif //ZIGBEEDEVICE_H
